<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>订单详情</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<jsp:include page="/page/head.jsp" />
	<script type="text/javascript">
		//返回
		function callback(){
			parent.window.location = path+"/order/orderMgr.do";
		}
		
		/* 确认  */
		function comfireProduct(orderNo){
			var expcom = escape(escape($('#expcom').val()));               //获取物流公司名称
			var expNo = escape(escape($('#expNo').val()));                 //获取物流单号
			if(orderNo!=null){
				$.ajax({
					  url: path+"/order/comfireProduct.do?orderNo="+orderNo+"&expcom="+expcom+"&expNo="+expNo,
					  success: function(data) {
						   if(data == "0"){
								/* $('#mgrTable').datagrid('reload');
								$('#mgrTable').datagrid('clearSelections'); */
								alertBox("发货成功！");
						   }else{
								alertBox("发货失败！");
						   }
					  }
				});
			}
		}
	</script>
</head>

<body>
	<div class="right">
		<div class="ri_main">
			<table width="90%" border="0" cellspacing="1" cellpadding="8" style="background:#d9d9d9;">
			  <tr>
			    <td width="15%" align="center" bgcolor="#FFFFFF">订单状态操作</td>
			    <td bgcolor="#FFFFFF" align="left" colspan="3">
					<!-- onclick="comfireProduct(${order.orderNo})" -->
					<a href="javascript:void(0);" class="easyui-linkbutton">完成</a>
					<a href="javascript:void(0);" class="easyui-linkbutton" onclick="callback()">返回</a>
			    </td>
			  </tr>
			  
			  <tr>
			  	<td width="15%" align="center" bgcolor="#FFFFFF">订单编号：</td>
			  	<td width="25%" align="left" bgcolor="#FFFFFF">${order.orderNo}</td>
			  	<td bgcolor="#FFFFFF" width="15%" align="center">下单时间：</td>
				<td bgcolor="#FFFFFF">${order.concludeTime}</td>
			  </tr>
			  <tr>
			    <td align="center" width="15%" bgcolor="#FFFFFF">商品总积分：</td>
			    <td bgcolor="#FFFFFF" width="25%" align="left"><em class="price">${order.score}</em>  积分</td>
			    <td bgcolor="#FFFFFF" width="15%" align="center">商品总重量：</td>
			    <td bgcolor="#FFFFFF"align="left">${weight} /千克</td>	
			  </tr>
			  <tr>
			    <c:choose>
					<c:when test="${order.fareway == '1'}">
						<td width="15%" align="center" bgcolor="#FFFFFF">配送方式：</td>
						<td width="25%" align="left" bgcolor="#FFFFFF">
							<c:forEach var="fareway" items="${fareways}">
								<c:if test="${fareway.code == order.fareway}">
									<c:out value="${fareway.name }"></c:out>
								</c:if>
							</c:forEach>
						</td>
						<td width="15%" align="center" bgcolor="#FFFFFF">支付方式：</td>
						<td align="left" bgcolor="#FFFFFF"> 支付宝支付 </td>
					</c:when>
					<c:when test="${order.fareway == '2'}">
						<td width="15%" align="center" bgcolor="#FFFFFF">配送方式：</td>
						<td width="25%" align="left" bgcolor="#FFFFFF">
							<c:forEach var="fareway" items="${fareways}">
								<c:if test="${fareway.code == order.fareway}">
									<c:out value="${fareway.name }"></c:out>
								</c:if>
							</c:forEach>
						</td>
						<td width="15%" align="center" bgcolor="#FFFFFF">支付方式：</td>
						<td align="left" bgcolor="#FFFFFF"> 线下支付  </td>
					</c:when>
					<c:otherwise>
						<td  width="15%" align="center" bgcolor="#FFFFFF">配送方式：</td>
						<td colspan="3" align="left" bgcolor="#FFFFFF">
							<c:forEach var="fareway" items="${fareways}">
								<c:if test="${fareway.code == order.fareway}">
									<c:out value="${fareway.name }"></c:out>
								</c:if>
							</c:forEach>
						</td>
					</c:otherwise>
				</c:choose>
			  </tr>
			  <c:if test="${order.fareway == '1'}">
				  <tr>
				    <td align="center" bgcolor="#FFFFFF">配送运费：</td>
				    <td bgcolor="#FFFFFF" colspan="3" align="left">
				    	&yen;  ${order.fare}  元
				    </td>
				  </tr>
			  </c:if>
			</table>
			
			<table width="90%" border="0" cellpadding="8" cellspacing="1" class="margintop10" style="background:#d9d9d9;">
				<tbody>
					<tr>
						<td bgcolor="#FFFFFF" width="15%" align="center">收货人姓名：</td>
						<td bgcolor="#FFFFFF" width="25%">${order.consigneeName}</td>
						<td bgcolor="#FFFFFF" width="15%" align="center">手机：</td>
						<td bgcolor="#FFFFFF">${order.consigneeTel}</td>
						
					</tr>
					<tr>
						<td bgcolor="#FFFFFF" width="15%" align="center">收货省份：</td>
						<td bgcolor="#FFFFFF" width="25%">${order.province}</td>
						<td bgcolor="#FFFFFF" width="15%" align="center">详细地址：</td>
						<td bgcolor="#FFFFFF">${order.province} ${order.city} ${order.region} ${order.address}</td>
					</tr>
					<tr>
						<td bgcolor="#FFFFFF" width="15%" align="center">邮编：</td>
						<td bgcolor="#FFFFFF" align="left" colspan="3">${order.zipcode}</td>
					</tr>
				</tbody>
			</table>
			<!-- 当付款时间不为空并且非自提方式，则添加发货时的快递公司信息 -->
			<c:if test="${order.payTime != null && order.fareway != '3'}">
				<table width="90%" border="0" cellpadding="8" cellspacing="1" class="margintop10" style="background:#d9d9d9;">
					<tbody>
						<tr><!-- 状态如果是货到付邮，则不需要显示付款时间 -->
							<c:choose>
						  		<c:when test="${order.payTime == null && order.fareway == '1'}">
						  			<td bgcolor="#FFFFFF" width="15%" align="center">所需运费：</td>
									<td bgcolor="#FFFFFF">&yen;  ${order.fare}元</td>
						  			<td width="15%" align="center" bgcolor="#FFFFFF">付款情况：</td>
						    		<td align="left" bgcolor="#FFFFFF"><font color="red">未付款</font></td>
						  		</c:when>
						  		<c:when test="${order.payTime == null && order.fareway == '2'}">
						  			<td bgcolor="#FFFFFF" width="15%" align="center">所需运费：</td>
									<td bgcolor="#FFFFFF" colspan="3">&yen;  ${order.fare}元</td>
						  		</c:when>
						  		<c:otherwise>
						  			<td bgcolor="#FFFFFF" width="15%" align="center">所需运费：</td>
									<td bgcolor="#FFFFFF">&yen;  ${order.fare}元</td>
						  			<td width="15%" align="center" bgcolor="#FFFFFF">付款时间：</td>
						    		<td align="left" bgcolor="#FFFFFF">${order.payTime}</td>
						  		</c:otherwise>
						  	</c:choose>
						</tr>
						<tr>
							<td bgcolor="#FFFFFF" width="15%" align="center">物流公司：</td>
							<td bgcolor="#FFFFFF" width="25%">
								<select name="select" id="expcom">
									<option value="0">全日通快递</option>
									<option value="1">亚风速递</option>
									<option value="2">百世物流</option>
									<option value="3">韵达快运</option>
									<option value="4">中通速递</option>
								</select>
							</td>
							<td bgcolor="#FFFFFF" width="15%" align="center">物流单号：</td>
							<td bgcolor="#FFFFFF"><input type="text" id="expNo" class="input-txt" value="${order.expNo}" /></td>
						</tr>
						<tr>
							<td bgcolor="#FFFFFF" width="15%" align="center">备注：</td>
			    			<td bgcolor="#FFFFFF" align="left" colspan="3">${order.remarks}</td>
						</tr>
					</tbody>
				</table>
			</c:if>
		</div>
	</div>
	
	
</body>
</html>